<!-- 库存记录详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="stockRecordModalApp.stockRecord"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="stockRecordModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ stockRecordModalApp.stockRecord.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ stockRecordModalApp.stockRecord.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ stockRecordModalApp.stockRecord.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="材料id">
                        {{ stockRecordModalApp.stockRecord.materialId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="数量">
                        {{ stockRecordModalApp.stockRecord.quantity }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="操作">
                        {{ stockRecordModalApp.stockRecord.operation }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="入库仓库id">
                        {{ stockRecordModalApp.stockRecord.inStoreId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="出库仓库id">
                        {{ stockRecordModalApp.stockRecord.outStoreId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="状态">
                        {{ stockRecordModalApp.stockRecord.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ stockRecordModalApp.stockRecord.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ stockRecordModalApp.stockRecord.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ stockRecordModalApp.stockRecord.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {StockRecordService} from "@/views/restaurant/material/stockRecord/stockRecordService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let stockRecordListApp = inject('stockRecordListApp', reactive({}));
            const stockRecordModalApp = reactive({id: null, stockRecord: {}, display: false});

            onMounted(() => {
                    stockRecordModalApp.stockRecord = {};
                if (routeId) {
                        stockRecordModalApp.id = routeId;
                } else if (stockRecordListApp.viewModalShowing) {
                        stockRecordModalApp.id = stockRecordListApp.currentId;
                        stockRecordModalApp.display = true;
                }
                if (stockRecordModalApp.id) {
                    getInfo(stockRecordModalApp.id);
                }
            })

            const getInfo = (id) => {
                    StockRecordService.findStockRecord(id).then((res) => {
                            stockRecordModalApp.stockRecord = res.data;
                            stockRecordModalApp.title = "查看 " + stockRecordModalApp.stockRecord.name;
                })
            }

            return {
                    stockRecordModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

